/**
 *Copyright (c) 2024 watereyes
 * safetymanagement is licensed under Mulan PubL v2.
 * You can use this software according to the terms and conditions of the Mulan
 * PubL v2.
 * You may obtain a copy of Mulan PubL v2 at:
 *          http://license.coscl.org.cn/MulanPubL-2.0
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PubL v2 for more details.
 */
package com.koron.report.util;

public enum BusinessCode {
    SUCCESS(0,"success"),
    FAILURE(-1,"fail"),
    EXCEPTION(-2,"数据库异常"),
    NOT_LOGIN(10000,"当前未登录"),
    EMPTY_PARAM_REQUIRED(-3,"必填参数不能为空"),
    NOT_FOUND_CORP(101,"未找到对应的水司"),
    ILEGAL_ORGLEVEL(102,"暂无数据"),
    ;
    private final int code;
    private final String description;

    public int getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    BusinessCode(int code, String description) {
        this.code = code;
        this.description = description;
    }
    public static BusinessCode valueOf(int value){
        switch (value){
            case 0:
                return SUCCESS;
            case -1:
                return FAILURE;
            case -2:
                return EXCEPTION;
            case -3:
                return EMPTY_PARAM_REQUIRED;
            case 10000:
                return NOT_LOGIN;
            case 101:
                return NOT_FOUND_CORP;
            case 102:
                return ILEGAL_ORGLEVEL;
            default:
                    return null;
        }
    }
}
